Externalize secondary storage capacity threshold#4790
Conversation
| s_logger.warn(String.format("Invalid [%s] configuration: value set [%s] is [%s]. Assuming %s as secondary storage capacity threshold.", | ||
| secondaryStorageCapacityThreshold.key(), | ||
| thresholdConfig, | ||
| thresholdConfig < MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD ? String.format("lower than '%s'", MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD) : String.format("bigger than '%s'", MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD), | ||
| MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD)); | ||
| return MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD; |
There was a problem hiding this comment.
makes you wish for a bounds checker on entry, 👍
| thresholdConfig, | ||
| thresholdConfig < MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD ? String.format("lower than '%s'", MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD) : String.format("bigger than '%s'", MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD), | ||
| MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD)); | ||
| return MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD; |
There was a problem hiding this comment.
i think we should revert to default, i.e. 0.9
There was a problem hiding this comment.
I thought about it too and came to a possible resolution:
- When the config is bigger than max, I think we should return max (as it is top limit);
- When the config is lower than min, then we use default;
What do you think?
There was a problem hiding this comment.
@GutoVeronezi these value limits are controlled/validated in the configuration manager. you can add this new config to 'weightBasedParametersForValidation' in configuration manager. check here:
you can simply return threshold config value here.
3fc2702 to
3ec2ed6
Compare
GabrielBrascher
left a comment
There was a problem hiding this comment.
Code LGTM. I did not test it, though.
|
@blueorangutan package |
|
@GabrielBrascher a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ centos7 ✔️ centos8 ✔️ debian. SL-JID 440 |
|
@DaanHoogland @GabrielBrascher is there anything else to do? |
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ centos7 ✔️ centos8 ✔️ debian. SL-JID 88 |
| return true; | ||
| } | ||
|
|
||
| s_logger.warn(String.format("Image storage [%s] has not enough capacity. Capacity: total=[%s], used=[%s], threshold=[%s%%].", imageStoreId,readableTotalCapacity, readableUsedCapacity, threshold * 100)); |
There was a problem hiding this comment.
| s_logger.warn(String.format("Image storage [%s] has not enough capacity. Capacity: total=[%s], used=[%s], threshold=[%s%%].", imageStoreId,readableTotalCapacity, readableUsedCapacity, threshold * 100)); | |
| s_logger.warn(String.format("Image storage [%s] has not enough capacity.", imageStoreId)); |
capacity/used bytes and threshold already logged above, may not be required here.
There was a problem hiding this comment.
I think it could be interesting to log here too to not depend on another log line; Also we could lose the information in some situations.
| "URI to send StatsCollector statistics to. The collector is defined on the URI scheme. Example: graphite://graphite-hostaddress:port or influxdb://influxdb-hostaddress/dbname. Note that the port is optional, if not added the default port for the respective collector (graphite or influxdb) will be used. Additionally, the database name '/dbname' is also optional; default db name is 'cloudstack'. You must create and configure the database if using influxdb.", | ||
| true); | ||
| private static final ConfigKey<Double> secondaryStorageCapacityThreshold = new ConfigKey<Double>("Advanced", Double.class, "secondary.storage.capacity.threshold", "0.90", | ||
| "Secondary storage capacity threshold (1 = 100%).", true); |
There was a problem hiding this comment.
@GutoVeronezi can you move this config to 'CapacityManager' ? and use it wherever applicable.
also, update StorageOrchestrator class with this config, it is hardcoded here:
| private static final String INFLUXDB_HOST_MEASUREMENT = "host_stats"; | ||
| private static final String INFLUXDB_VM_MEASUREMENT = "vm_stats"; | ||
|
|
||
| private static final double MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD = 0.00; |
There was a problem hiding this comment.
| private static final double MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD = 0.00; | |
| private static final double MIN_SECONDARY_STORAGE_CAPACITY_THRESHOLD = 0.00; |
Note: this is not required, If you use configuration framework.
| private static final String INFLUXDB_VM_MEASUREMENT = "vm_stats"; | ||
|
|
||
| private static final double MIN_STORAGE_SECONDARY_CAPACITY_THRESHOLD = 0.00; | ||
| private static final double MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD = 1.00; |
There was a problem hiding this comment.
| private static final double MAX_STORAGE_SECONDARY_CAPACITY_THRESHOLD = 1.00; | |
| private static final double MAX_SECONDARY_STORAGE_CAPACITY_THRESHOLD = 1.00; |
Note: this is not required, If you use configuration framework.
| private static final ConfigKey<String> statsOutputUri = new ConfigKey<String>("Advanced", String.class, "stats.output.uri", "", | ||
| "URI to send StatsCollector statistics to. The collector is defined on the URI scheme. Example: graphite://graphite-hostaddress:port or influxdb://influxdb-hostaddress/dbname. Note that the port is optional, if not added the default port for the respective collector (graphite or influxdb) will be used. Additionally, the database name '/dbname' is also optional; default db name is 'cloudstack'. You must create and configure the database if using influxdb.", | ||
| true); | ||
| private static final ConfigKey<Double> secondaryStorageCapacityThreshold = new ConfigKey<Double>("Advanced", Double.class, "secondary.storage.capacity.threshold", "0.90", |
There was a problem hiding this comment.
The description for most of the percentage based configs clear indicate that values should be between 0 and 1, and same is being validated in the configuration manager. can you search code with string 'Percentage (as a value between 0 and 1) ' and update the config description as appropriate. Thanks.
|
@sureshanaparti Thank you for the review. As you suggested, I added the config to the validation in |
|
@sureshanaparti are you satisfied? |
|
@sureshanaparti @DaanHoogland @GabrielBrascher is there anything else to do? |
1 similar comment
|
@sureshanaparti @DaanHoogland @GabrielBrascher is there anything else to do? |
@GutoVeronezi agree, these validations can be refactored in another PR. |
|
@blueorangutan package |
|
@sureshanaparti a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian. SL-JID 533 |
|
@blueorangutan test |
|
@sureshanaparti a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-1250)
|
Description
On StatsCollector, it limits secondary storages capacity to 90%; therefore, operators do not have option to choose which threshold they want/need.
This PR intends to externalize the secondary storage capacity threshold configuration on StatsCollector (
secondary.storage.capacity.threshold), validating if it is between 0 and 100% (0.00 and 1.00).Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
How Has This Been Tested?
It has been tested locally on a test lab.